package br.com.k19.jpa;



import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class ListaEditorasComJPA {
	public static void main(String[] args) {
		EntityManagerFactory factory = 
				Persistence.createEntityManagerFactory("livraria-pu");
		
		EntityManager manager = factory.createEntityManager();
		
		EditoraRepository editoraRepository = new EditoraRepository(manager);
		List<Editora> editoras = editoraRepository.buscaTodas();
		
		for(Editora e : editoras){
			System.out.println("Editora: "+ e.getNome() + "-" + e.getEmail());
		}
		manager.close();
		factory.close();
	}

}
